import React, { useState,useEffect } from 'react';
function Hooks(){
  const [num, handChange] = useState(0)
  const [sex, handSex] = useState('男')
  useEffect(() => {
   console.log(`你点击了${num} 次`);
  })
 
  return (
    <div>
        <h2>react Hooks基本用法</h2><br />
        <h3>你点击了 {num} 次！</h3>
        <button onClick={()=>{handChange(num+1)}}>点击加1</button>
        <h3>性别： {sex}</h3>
        <button onClick={() => { handSex(sex==='男'?'女': '男') }}>改名性别</button>
        
      </div>
  )
}
export default Hooks


